When not wrapping, do the offset of the line for justification ourselves.
authorOwen Taylor <otaylor@redhat.com>
Sat, 13 Mar 2004 23:28:14 +0000 (23:28 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 13 Mar 2004 23:28:14 +0000 (23:28 +0000)
Sat Mar 13 18:13:13 2004  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): When not
        wrapping, do the offset of the line for justification ourselves.
        (#120256, Felipe Heidrich)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktextlayout.c

index 359e0b398f92c712f4aeab7be344cfff15e95cf2..02336844734e1bbfa117756f1c4d7eebb118fb72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Mar 13 18:13:13 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): When not
+       wrapping, do the offset of the line for justification ourselves.
+       (#120256, Felipe Heidrich)
+
 Sun Mar 14 00:03:18 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcellview.c (gtk_cell_view_expose): Support the
index 359e0b398f92c712f4aeab7be344cfff15e95cf2..02336844734e1bbfa117756f1c4d7eebb118fb72 100644 (file)
@@ -1,3 +1,9 @@
+Sat Mar 13 18:13:13 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): When not
+       wrapping, do the offset of the line for justification ourselves.
+       (#120256, Felipe Heidrich)
+
 Sun Mar 14 00:03:18 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcellview.c (gtk_cell_view_expose): Support the
index 359e0b398f92c712f4aeab7be344cfff15e95cf2..02336844734e1bbfa117756f1c4d7eebb118fb72 100644 (file)
@@ -1,3 +1,9 @@
+Sat Mar 13 18:13:13 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): When not
+       wrapping, do the offset of the line for justification ourselves.
+       (#120256, Felipe Heidrich)
+
 Sun Mar 14 00:03:18 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcellview.c (gtk_cell_view_expose): Support the
index 359e0b398f92c712f4aeab7be344cfff15e95cf2..02336844734e1bbfa117756f1c4d7eebb118fb72 100644 (file)
@@ -1,3 +1,9 @@
+Sat Mar 13 18:13:13 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): When not
+       wrapping, do the offset of the line for justification ourselves.
+       (#120256, Felipe Heidrich)
+
 Sun Mar 14 00:03:18 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcellview.c (gtk_cell_view_expose): Support the
index 359e0b398f92c712f4aeab7be344cfff15e95cf2..02336844734e1bbfa117756f1c4d7eebb118fb72 100644 (file)
@@ -1,3 +1,9 @@
+Sat Mar 13 18:13:13 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): When not
+       wrapping, do the offset of the line for justification ourselves.
+       (#120256, Felipe Heidrich)
+
 Sun Mar 14 00:03:18 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcellview.c (gtk_cell_view_expose): Support the
index 874dc3cd8419ed3fd7d68c667070eab9e0d167c8..60e8142d342cb327e1d8fd08d19556a1ba4281ff 100644 (file)
@@ -1294,7 +1294,7 @@ set_para_values (GtkTextLayout      *layout,
     case GTK_WRAP_NONE:
       break;
     }
-  
+
   display->total_width = MAX (layout->screen_width, layout->width) - display->left_margin - display->right_margin;
 }
 
@@ -2090,6 +2090,26 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
 
   display->width = PIXEL_BOUND (extents.width) + display->left_margin + display->right_margin;
   display->height += PANGO_PIXELS (extents.height);
+
+  /* If we aren't wrapping, we need to do the alignment of each
+   * paragraph ourselves.
+   */
+  if (pango_layout_get_width (display->layout) < 0)
+    {
+      gint excess = display->total_width - display->width;
+
+      switch (pango_layout_get_alignment (display->layout))
+       {
+       case PANGO_ALIGN_LEFT:
+         break;
+       case PANGO_ALIGN_CENTER:
+         display->x_offset += excess / 2;
+         break;
+       case PANGO_ALIGN_RIGHT:
+         display->x_offset += excess;
+         break;
+       }
+    }
   
   /* Free this if we aren't in a loop */
   if (layout->wrap_loop_count == 0)